package com.wyh.mapper.gfivemapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wyh.common.result.InvoicerecordsShowResult;
import com.wyh.domain.po.gfive.Invoicedetails;
import com.wyh.domain.po.gfive.Invoicerecords;
import com.wyh.domain.po.gfive.PageHelper;
import com.wyh.domain.vo.gfive.TelAndEmailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author KmJHHhhhR
* @description 针对表【invoicerecords(开票记录表)】的数据库操作Mapper
* @createDate 2024-05-28 10:10:35
* @Entity generator.domain.Invoicerecordes
*/
@Mapper
public interface InvoicerecordsMapper extends BaseMapper<Invoicerecords> {
        @Select("SELECT invoicerecords.id,invoicerecords.serialnumber,invoicerecords.noticenumber,invoicerecords.Invoicingtime,invoicerecords.amount,customer.name,changerecords.receiptnumber" +
                "       FROM invoicerecords  INNER JOIN changerecords ON invoicerecords.owner = changerecords.owner" +
                "         INNER JOIN customer ON invoicerecords.buyer = customer.id" +
                "        WHERE invoicerecords.type = 1" +
                "        LIMIT #{currentPage}, #{pageSize}")
        List<InvoicerecordsShowResult> findAll(PageHelper pageHelper);

        List<InvoicerecordsShowResult> findInvoicerecords(InvoicerecordsShowResult invoicerecordsShowResult,PageHelper pageHelper);

        @Select("SELECT telephone,email from customer where id = #{id}")
        TelAndEmailVO findTelAndEmail(Integer id);

        @Select("SELECT buyer from invoicerecords where id = #{id}")
        Integer findCustomerId(Integer id);

        /**
         * 回滚金额
         */
        int UpdateMoey(@Param("money") Double money, @Param("billid")Integer billid);

        @Select("SELECT * from invoicerecords where id = #{id}")
        Invoicerecords findOne(Integer id);

        List<Invoicedetails> seeInvoicedetails(String receiptnumber);
}




